﻿using LbangCMS.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace LbangCMS.Areas.Admin.Controllers
{
    public class AccountController : Controller
    {
        private IAuthenticationService _authService = new AuthenticationService();

        // GET: Admin/Account
        public ActionResult Login()
        {
            return View();
        }
        [HttpPost]
        public ActionResult Login(string userName,string password)
        {
            if(userName.ToLower()=="admin"&&password=="123654")
            {
                _authService.SignIn("1","admin",false);
                return Json(new { success = true });
            }
            else
            {
                return Json(new { success = false, errorMsg = "登录账号或密码错误" });
            }
        }
        public ActionResult Logout()
        {
            _authService.SignOut();
            return RedirectToAction("Login");
        }
    }
}